package com.xisoft.common.pubEnv;

import cn.hutool.core.lang.UUID;

/**
 * *
 * Created with Description:
 *
 * @version 1.0 <br>
 * @packagename: com.xisoft.common<br>
 * @author: LiBencheng <br>
 * @computer: licheng <br>
 * @date: Created on 2022/8/31 18:22 <br>
 */
public class GenerateUtil
{
    private String getUUID( )
    { return "yyds" + UUID.fastUUID().toString(true).trim(); }

    public static String generateID( )
    { return getInstance().getUUID(); }

    private static ThreadLocal< GenerateUtil > jsonUtil = new ThreadLocal< GenerateUtil >();

    public static GenerateUtil getInstance( )
    {
        GenerateUtil df = jsonUtil.get();
        if (null == df)
        {
            synchronized ( JsonUtil.class )
            {
                if (null == df)
                {
                    df = new GenerateUtil();
                    jsonUtil.set(df);
                }
            }
        }

        return df;
    }
}
